package com.jianhua.backend.service.impl;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jianhua.backend.domain.entity.Categories;
import com.jianhua.backend.mapper.CategoriesMapper;
import com.jianhua.backend.service.CategoriesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 支持多级菜品分类，如清真/非清真、热食/冷食等 服务实现类
 * </p>
 *
 * @author author
 * @since 2025-07-02
 */
@Service
public class CategoriesServiceImpl extends ServiceImpl<CategoriesMapper, Categories> implements CategoriesService {

    @Autowired
    private CategoriesMapper categoriesMapper;

    @Override
    public List<Categories> listCategories() {
        List<Categories> categories = categoriesMapper.selectList(null);
        return categories;
    }

    @Override
    public void addCategories(Categories categories) {
        categoriesMapper.insert(categories);
    }

    @Override
    public void updateCategories(Categories categories) {
        categoriesMapper.updateById(categories);
    }

    @Override
    public void deleteCategories(Integer id) {
        categoriesMapper.deleteById(id);
    }

}
